#include "LookWhereYoureGoing.h"
#include "SteeringOutput.h"
#include "MathUtility.h"

namespace Engine
{
	LookWhereYoureGoing::LookWhereYoureGoing():m_actualTarget(nullptr){m_target = new Agent;}

	void LookWhereYoureGoing::SetTarget(Agent* t)
	{
		m_actualTarget = t;
	}

	void LookWhereYoureGoing::Update(SteeringOutput* output)
	{
		//Vec3 direction = m_actualTarget ->GetPos() - m_parent ->GetPos();
		if(m_parent->GetSpeed() == 0)
			return;

		Align::m_target ->SetRot(VecToRad(m_parent ->GetVel()));

		Align::Update(output);
	}

	LookWhereYoureGoing::~LookWhereYoureGoing()
	{
		if(m_target) delete m_target;
	}
}